import { IPSChartPolarAngleAxis } from './ipschart-polar-angle-axis';
import { IPSChartPolarRadiusAxis } from './ipschart-polar-radius-axis';
import { IPSDEChartPolar } from './ipsdechart-polar';
import { PSDEChartCoordinateSystemControlImplBase } from './psdechart-coordinate-system-control-impl-base';

export class PSDEChartPolarImpl extends PSDEChartCoordinateSystemControlImplBase implements IPSDEChartPolar {
  protected pschartpolarangleaxis: IPSChartPolarAngleAxis | null = null;

  getPSChartPolarAngleAxis(): IPSChartPolarAngleAxis | null {
    if (this.pschartpolarangleaxis != null) return this.pschartpolarangleaxis;
    const value = this.M.getPSChartPolarAngleAxis;
    if (value == null) {
      return null;
    }
    this.pschartpolarangleaxis = this.getPSModel4('control.chart.IPSChartPolarAngleAxis', value, 'getPSChartPolarAngleAxis') as IPSChartPolarAngleAxis;
    return this.pschartpolarangleaxis;
  }

  get psChartPolarAngleAxis(): IPSChartPolarAngleAxis | null {
    return this.getPSChartPolarAngleAxis();
  }

  getPSChartPolarAngleAxisMust(): IPSChartPolarAngleAxis {
    const value = this.getPSChartPolarAngleAxis();
    if (value == null) {
      throw new Error('未指定角度轴');
    }
    return value;
  }

  protected pschartpolarradiusaxis: IPSChartPolarRadiusAxis | null = null;

  getPSChartPolarRadiusAxis(): IPSChartPolarRadiusAxis | null {
    if (this.pschartpolarradiusaxis != null) return this.pschartpolarradiusaxis;
    const value = this.M.getPSChartPolarRadiusAxis;
    if (value == null) {
      return null;
    }
    this.pschartpolarradiusaxis = this.getPSModel4('control.chart.IPSChartPolarRadiusAxis', value, 'getPSChartPolarRadiusAxis') as IPSChartPolarRadiusAxis;
    return this.pschartpolarradiusaxis;
  }

  get psChartPolarRadiusAxis(): IPSChartPolarRadiusAxis | null {
    return this.getPSChartPolarRadiusAxis();
  }

  getPSChartPolarRadiusAxisMust(): IPSChartPolarRadiusAxis {
    const value = this.getPSChartPolarRadiusAxis();
    if (value == null) {
      throw new Error('未指定径向轴');
    }
    return value;
  }

  get cls(): string {
    return 'PSDEChartPolarImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.chart.IPSChartPolar' || cls == 'control.chart.IPSDEChartObject' || cls == 'control.chart.IPSDEChartPolar') return true;
    return super.instanceof(cls);
  }
}
